package com.siss.tenancy.user.controller;

import com.siss.tenancy.finals.CodeDescFinal;
import com.siss.tenancy.finals.SystemFinal;
import com.siss.tenancy.msg.RspMessage;
import com.siss.tenancy.user.service.SissStarPauseResultService;
import com.siss.tenancy.user.utils.RedisUtil;
import com.siss.tenancy.vo.CodeDesc;
import com.siss.tenancy.vo.PageResult;
import io.seata.core.context.RootContext;
import io.seata.spring.annotation.GlobalTransactional;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RequestMapping("/pauseStar")
@RestController
@Api(value = "SissStarPauseResultController", description = "暂停星级接口")
@SuppressWarnings("unchecked")

public class SissStarPauseResultController {

    private static final Logger LOGGER = LoggerFactory.getLogger(SissStarPauseResultController.class);


    @Autowired
    SissStarPauseResultService sissStarPauseResultService;

    @Autowired
    private RedisUtil redisUtil;
    

    @GetMapping("/user")
    @GlobalTransactional(timeoutMills = 30000, name = "myGlobalText",rollbackFor = Exception.class)
    public String dbInfo(@RequestParam("noTrans") Integer noTrans) {
        //不从缓存获取，直接写死为常量
        LOGGER.info("Order Service Begin ... xid: " + RootContext.getXID());
        int i = sissStarPauseResultService.updateTransaction(noTrans);
        if(i == 0){
            return "false";
        }
        return "success";
    }
}
